/*
 *          		  MidiMaker 
 *       		   (Working title)
 *  		Joe Mirizio & Earl Bellinger
 * 
 *	GNU General Public License version 3.0 (GPLv3)
 */
package midimaker;

import javax.sound.midi.Track;

public class Drum extends InstrumentTrack {

    public Drum(Track track, int channel) {
        super(track, channel);
        super.notes = new int[47][1];
        for (int i = 0; i < notes.length; i++)
            notes[i] = new int[]{i + 34};
        setOctave(0);
    }

    /*public int[][] generateNotes(int[] harmony) {
    int[][] a = new int[harmony.length * 4][];
    for (int i = 0; i < a.length; i++)
    a[i] = new int[]{43, i * 4, 1};
    return a;
    }*/
    public int[][] generateNotes(int[] harmony) {
        int[][] a = new int[4 * harmony.length][];
        for (int i = 0; i < a.length - 3; i = i + 4)
            for (int j = 0; j < 4; j++)
                a[i + j] = new int[]{8, i + j};

        int[][] b = new int[3][];
        b[0] = new int[]{15, 0};
        b[1] = new int[]{12, 2 * harmony.length};
        b[2] = new int[]{6, (4 * harmony.length) - 2};

        int[][] c = new int[4 * harmony.length][];
        for (int i = 0; i < c.length; i++)
            if (i % 2 == 0) c[i] = new int[]{1, i};
            else c[i] = new int[]{6, i};


        int[][] concat = new int[a.length + b.length + c.length][];
        int counter = 0;
        for (int[] lol : a) {
            concat[counter] = lol;
            counter++;
        }
        for (int[] lol : b) {
            concat[counter] = lol;
            counter++;
        }
        for (int[] lol : c) {
            concat[counter] = lol;
            counter++;
        }
        return concat;
    }
}
